// 项目变更记录列表
var changeColumns = [{
  id: 'createTime',
  title: '日期',
  width: 100,
    type: 'date',
    format:'yyyy-MM-dd',
    otype:'time_stamp_ms',
  columnClass: 'text-center',
}, {
    id: 'operateName',
    title: '申请人',
    width: 80,
    type: 'string',
    columnClass: 'text-center'
},{
  id: 'changeMessage',
  title: '变更说明',
  type: 'string',
  columnClass: 'text-left',
},{
    id: 'nodeFlag',
    title: '状态',
    type: 'string',
    width: 90,
    columnClass: 'text-center',
    resolution: function (value) {
        var content = '';
        if (value == 1) {
            content = '申请待审批';
        }else if (value == 2) {
            content = '已退回';
        }else if(value==3){
            content = '申请待审批';
        }else if(value==4){
            content = '申请不通过';
        }else if (value==5){
            content = '申请待审批';
        }else{
            content = '申请通过';
        }
        return content;
    }
},{
    id: 'operation',
    title: '操作',
    width: 100,
    type: 'string',
    columnClass: 'text-center',
    resolution: function (value, record) {
        var content = '';
        content += '<button class="btn btn-xs btn-primary" onclick="ckDetail(\'' + record.stepInstanceId + '\');"><i class="icon-eye-open"></i>  查看详情</button>';
        return content;
    }
}];
$certusUtils.ajax("findProBgInfos",{"proId":proId},function (response) {
    var changeOption = {
        lang: 'zh-cn',
        ajaxLoad: false,
        extraWidth: 20,
        // loadURL:'url',
        exportFileName: '项目变更',
        datas: response.data,
        columns: changeColumns,
        gridContainer: 'changeContainer',
        toolbarContainer: 'changeToolBarContainer',
        tools: '',
        pageSize: 10,
        pageSizeLimit: [10, 15, 20]
    };
    var changeGrid = $.fn.dlshouwen.grid.init(changeOption);
    changeGrid.load();
});

function ckDetail(stepId) {
    toLoadHtml("33-1",stepId);
}

function editChange(id) {
    toLoadHtml(33,id);
}
function delChange(id) {
    layer.confirm('是否确认删除？', {
        btn : [ '确定', '取消' ]//按钮
    }, function(index) {
        $certusUtils.ajax("delCr",{"id":id},function () {
            layer.msg("删除成功");
            toLoadHtml(27);
        })
    });
}